<!DOCTYPE html>
<html>
	<head>
		<title>Framekiller Killer Demo</title>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		<link href="http://home4j.duapp.com/share/bootstrap/css/bootstrap.min.css" rel="stylesheet">
		<script src="http://home4j.duapp.com/share/jquery/jquery-2.min.js" type="text/javascript"></script>
		<script src="http://home4j.duapp.com/share/syntaxhighlighter/scripts/shCore.js" type="text/javascript"></script>
		<script src="http://home4j.duapp.com/share/syntaxhighlighter/scripts/shBrushJScript.js" type="text/javascript"></script>
		<link href="http://home4j.duapp.com/share/syntaxhighlighter/styles/shCoreDefault.css" rel="stylesheet"/>
		<script src="assets/share.js" type="text/javascript"></script>
		<link href="assets/share.css" rel="stylesheet"/>
		<script>
			var prevent_bust = 0;
			window.onbeforeunload = function() {
				// onbeforeunload will be invoked twice, one for the frame itself, one for the 204 page.
				prevent_bust++;
			};
			setInterval(function() {
				if (prevent_bust > 0) {
					prevent_bust -= 2;
					window.top.location = 'http://demo4j.duapp.com/204';
				}
			}, 1);
		</script>
	</head>
	<body>
		<div class="container">
			<div class="page-header">
				<h2>Framekiller Killer页面</h2>
			</div>
			<p>
				通过iframe直接把framekiller.html嵌入展示，4秒后被跳转到嵌套的页面中（在Chrome下无效）。
			</p>
			<div class="panel panel-success">
				<div class="panel-heading">
					Code
				</div>
				<div class="panel-body">
					<pre class="brush: js;">
var prevent_bust = 0;
window.onbeforeunload = function() {
	// onbeforeunload will be invoked twice, one for the frame itself, one for the 204 page.
	prevent_bust++;
};
setInterval(function() {
	if (prevent_bust > 0) {
		prevent_bust -= 2;
		window.top.location = 'http://demo4j.duapp.com/204';
	}
}, 1);
</pre>
				</div>
			</div>
			<div class="panel panel-warning">
				<div class="panel-heading">
					Iframe
				</div>
				<div class="panel-body frame-container">
					<iframe src="framekiller.html"></iframe>
				</div>
			</div>
		</div>
	</body>
</html>